#pragma once

namespace gk
{
	struct StateBlock
	{
		struct StateValue
		{
			union 
			{
				RenderStateValue::Enum	m_renderStateValue;
				SamplerStateValue::Enum	m_samplerStateValue;
				cr::uint32_t			m_intValue;
				float					m_floatValue;
			};

			bool operator != (const StateValue& other)
			{
				return m_intValue != other.m_intValue;
			}
		};
		
		StateValue			m_renderStateValues[RenderState::NumberOf];
		StateValue			m_samplerStateValues[SamplerIndex::NumberOf][SamplerState::NumberOf];

		StateBlockInternal	m_internal;

		StateValue& 		GetStateValue(RenderState::Enum state)								{ return m_renderStateValues[state]; }
		StateValue& 		GetStateValue(SamplerIndex::Enum index, SamplerState::Enum state)	{ return m_samplerStateValues[index][state]; }

		void				SetDefault();
		void				Invalidate();
	};

	typedef cr::Handle<StateBlock> StateBlockHandle;
}